package com.itany.corejava.code09_集合.Map;

import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

/**
 * @author 石小俊
 * 2024年07月25日 14:09
 */
public class Test07_获取系统属性 {

    public static void main(String[] args) {
        // 获取所有的系统属性信息
        Properties properties = System.getProperties();
        System.out.println(properties);

        Set<Map.Entry<Object, Object>> keys = properties.entrySet();
        Iterator<Map.Entry<Object, Object>> it = keys.iterator();
        while (it.hasNext()) {
            Map.Entry<Object, Object> entry = it.next();
            String key = (String) entry.getKey();
            String value = (String) entry.getValue();
            System.out.println(key + "=" + value);
        }
        System.out.println("JAVA_HOME:" + properties.getProperty("java.home"));
        System.out.println("java版本:" + properties.getProperty("java.version"));
    }

}
